% by YLX on 6/11
% Version 3.1
% Update log 
%% changed the sequence of global variables
%% changed function name removeRepeated -> prunePIE
% function PIE = findPIE(m)
function findPIE(m)
    %st = ftimer();
    global J % 全局变量 全局使用
    global PIE
    global seq index  % used in expandFor

    PIE = zeros(nchoosek(m+J-1, J-1), J);
    index = 1;
    seq = zeros(1, J-1);

    expandFor(m, J-1) % raw PIE was filled here
    % PIE = prunePIE(PIE, s_row); 
    % 删除不符合规则的pie
    % 与 SBY 的 realPIE类似
    %global T_findPIE N_findPIE
    %T_findPIE = T_findPIE + ftimer()-st;
    %N_findPIE = N_findPIE + 1;
    return;